import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { MarryInvitedData } from "../defin/MarryInvitedData";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class MarryInvitedFriendCell
    
    export  class MarryInvitedFriendCell extends CellRenderer
    {
        constructor()
        {
            super();
            this.initStyles();
            this.create();
            this.mouseEnabled = true;
            this.mouseChildren = true;
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("overSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap("Friend_over"));
            return;
        }

        /* internal  */create(): void
        {
            this._tfGuestName = ObjCreate.createTextField("", 5, 3, 95, 20, this, GlobalStyle.textFormat6);
            this._btnCancel = ObjCreate.createGButton(Language.getString(43532), 95, 0, 46, 22, this);
            this._tfHaveInvited = ObjCreate.createTextField(Language.getString(43605), 97, 3, 50, 20, this, GlobalStyle.textFormat6);
            this._tfHaveInvited.visible = false;
            this._btnCancel.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelClick);
            return;
        }

        /* internal  */onCancelClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._marryInvitedData) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.MarryFriendCancelInvite, this._marryInvitedData.friendName));
            }
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "marryinviteddata") 
            {
                this._marryInvitedData = arg1 as MarryInvitedData;
                this.updateView();
                this.drawNow();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            this._tfGuestName.text = this._marryInvitedData.friendName;
            this._btnCancel.visible = !this._marryInvitedData.isInvited;
            this._tfHaveInvited.visible = this._marryInvitedData.isInvited;
            this._btnCancel.drawNow();
            return;
        }

        /* internal */ /* var */_tfGuestName: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnCancel: GButton;

        /* internal */ /* var */_tfHaveInvited: Object /* flash.text.TextField */;

        /* internal */ /* var */_marryInvitedData: MarryInvitedData;
    }
